package cn.exrick.xboot.modules.projectinfo.controller;

import cn.exrick.xboot.common.utils.ResultUtil;
import cn.exrick.xboot.common.vo.Result;
import cn.exrick.xboot.modules.projectinfo.entity.*;
import cn.exrick.xboot.modules.projectinfo.service.IProjectInfoService;
import com.baomidou.dynamic.datasource.annotation.DS;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author sdtf
 */
@Slf4j
@RestController
@DS("other")
@Api(tags = "首页数据大全")
@RequestMapping("/xboot/sysj")
@Transactional
public class DataController {

    @Autowired
    private IProjectInfoService iProjectInfoService;


    /**
     * 获取首页数据
     */
    @RequestMapping(value = "/getsydata", method = RequestMethod.GET)
    @ApiOperation(value = "首页数据本年")
    public Result getSYData() {
        List<SYData> requireData = iProjectInfoService.getSYData();
        return new ResultUtil<List<SYData>>().setData(requireData);
    }


    /**
     * 获取首页数据
     */
    @RequestMapping(value = "/getsydatabymonth", method = RequestMethod.GET)
    @ApiOperation(value = "首页数据本月")
    public Result getSYDataByMonth() {
        List<SYData> requireData = iProjectInfoService.getSYDataByMonth();
        return new ResultUtil<List<SYData>>().setData(requireData);
    }
}
